home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Bob 1.5.sit.hqx / Bob 1.5 / Y.bob < prev   
Text File  |  1993-10-02  |  382b  |  24 lines

  1. main()
  2. {
  3.     hello = "hello";
  4.     goodbye = "goodbye";
  5.     for (i = 0; i < 3000; ++i) {
  6.     x = hello + ' ' + goodbye;
  7.     hello = substr(x,0,5);
  8.     goodbye = substr(x,6,7);
  9.     }
  10.     print(x,"\n");
  11. }
  12.  
  13. substr(s,f,l; len,r,i)
  14. {
  15.     len = sizeof(s) - f;
  16.     if (l > len)
  17.     l = len;
  18.     if (l <= 0) return "";
  19.     r = newstring(l);
  20.     for (i = 0; --l >= 0; )
  21.     r[i++] = s[f++];
  22.     return r;
  23. }
  24.